net: add DHCP Option 121 (Classless Static Routes) support#2123
Conversation
Implement RFC 3442 classless static routes received via DHCP: - Add IPv4 static route table with longest-prefix-match lookup - Parse Option 121 from DHCP ACK via LWIP_HOOK_DHCP_PARSE_OPTION - Consult static routes during IP routing via LWIP_HOOK_IP4_ROUTE_SRC - Ignore Option 3 (Router) when Option 121 is present per RFC 3442 - Request Option 121 in DHCP parameter request list - Clean up routes on DHCP release/stop Note: vendor/lwip/src/core/ipv4/dhcp.c also requires modification (see Makefile).
francescolavra
left a comment
There was a problem hiding this comment.
@tpjg thanks for your PR.
This feature can be implemented entirely within lwIP, I don't see any advantage in implementing it in the Nanos code base. The fact that you had to make changes to lwIP means that doing everything via lwIP hooks is not feasible, and lwIP needs to be aware of this feature.
So I would rather have everything done inside lwIP.
|
Okay, I'll look into moving everything into lwIP. |
Remove route table and option parser from nanos; now built as native lwip feature via LWIP_DHCP_CLASSLESS_STATIC_ROUTES in lwipopts.h.
|
Hi @francescolavra ; it's been a while as I was focussing on other things. I have now rewritten this and I agree this is much cleaner. Almost everything is done within the forked lwip, almost nothing in the nanos repo, only the makefiles and a one line to enable the option 121: |
Implement RFC 3442 classless static routes received via DHCP to support receiving multiple routes (not just a default gateway). This is especially useful for servers deployed with multiple interfaces, e.g. one 'public' and one 'private' network interface.
Amongst other things this can be used to receive the route to reach the http://169.254.169.254 endpoint.
This has been tested on OpenStack / OVHcloud. Note that this also requires a change in the vendored LWIP (the makefile now pulls from my fork).
Not sure if this is interesting to get into upstream and it definitely needs (a lot of) review, sharing nonetheless.